package com.sinocare.report.controller;

import com.sinocare.common.entity.vo.Anomaly;
import com.sinocare.common.result.Result;
import com.sinocare.common.result.ResultCode;
import com.sinocare.report.service.AnomalyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@CrossOrigin
@RestController
@RequestMapping("/Anomaly")
@Api(tags = "报表管理接口")
public class AnomalyController {
    @Resource
    private AnomalyService anomalyService;


    @ApiOperation(value = "指标异常率报表", notes = "指标异常率报表", httpMethod = "GET")
    @RequestMapping(value = "anomaly", method = RequestMethod.GET)
    public Result findAnomaly() throws Exception{

            Integer hw1= anomalyService.man();
            Integer hw2= anomalyService.woman();
            int hw3=hw1+hw2;
            System.out.println(hw3);
            List<Integer> list=new ArrayList<>();
            list.add(hw1);
            list.add(hw2);
            list.add(hw3);
            Integer nan= list.get(0);
            Integer nv=list.get(1);
            System.out.println("男生："+nan);
            System.out.println("女生："+nv);
            System.out.println("总数人数："+hw3);

        return Result.ok(ResultCode.SUCCESS,list);
    }
}
